package com.fuershiye.woman.monitor.service;

import com.fuershiye.woman.monitor.beans.IdNameCode;
import com.fuershiye.woman.monitor.beans.IdNamePid;
import com.fuershiye.woman.monitor.beans.Page;
import com.fuershiye.woman.monitor.model.Indicator;

import java.util.List;

/**
 * @author yongyongdong
 *
 */
public interface IndicatorService {

    public void save(Indicator indicator);
    public void delete(Long id);
    public Indicator get(Long id);
    public Indicator findByCodeForms(String code, long formsid);
    Long getIdByCodeForms(String code, long formsid);

    /**	取当前表中最大(ID)数据
     * @return
     */
    public Indicator getTop();
    
    /**
     * @param sort(当前位置)
     * @param aim	方向 (1:比sort大的;	2:比sort小的)
     * @param count	取几条数据
     * @return
     */
//    public Indicator findBySort(Long sort, Integer aim, Integer count);

    /**
     * @param name	指标名称的模糊查询
     * @param type	指标的类型
     * @return
     */
    public List<Indicator> listByCondition(String name, Long formsid,  Integer monitor, Long type, Integer status, Page page);
    public List<Indicator> listByCondition(String name, Long formsid,  Integer status, Page page);
    /**
     * @param name	指标名称的模糊查询
     * @param type	指标的类型
     * @return
     */
    public List<Indicator> listByCondition(String name, Long formsid, Long type, Integer province, Integer status, Page page);
    public List<Indicator> listByCondition(String name, Integer country, Long formsid, Long type, Integer province, Integer status, Page page);
    public List<Indicator> listByCondition(String name, Long formsid, List<Long> type, Integer province, Integer sex, Integer status, Page page);
    public List<Indicator> listByConditionOppositeProvince(String name, Long formsid, List<Long> type, Integer province, Integer status, Page page);

    /**
     * 获取全部指标的数量
     * @return
     */
    public Integer getTotal(String name, Long formsid, List<Long> types, Integer province, Integer status);
    public Integer getTotalOppositeProvince(String name, Long formsid, List<Long> types, Integer province, Integer status);
    /**
     * 获取全部指标的数量
     * @return
     */
    public Integer getTotal(Integer status);
    /**
     * 获取全部指标的数量
     * @return
     */
    public Integer getTotalByCondition(Long formsid, Integer status);

    /**
     * 获取全部数据的数量
     * @return
     */
    public Integer getTotal(String name, Long type);
    
    /**
     * 获取是否是监测指标的数量
     * @return
     */
    public Integer getTotal(Integer province, Integer status);
    
    /**
     * 按照类型（领域）获取指标的数量
     * @return
     */
    public Integer getTotal(Long type, Integer status);
    /**
     * 按照类型（领域）获取指标的数量
     * @return
     */
    public Integer getTotal(Long formsid, Long type, Integer status);

    
    /**
     * @param pid	父级指标的id
     * @return
     */
    List<Indicator> getByPid(Long pid);
    List<Indicator> getByPidForms(Long pid, Long formsid, Integer status);

    List<Indicator> listByCondition(Long type, Integer status, Page page);
    List<Indicator> listByCondition(String name, Long formsid,  List<Long> types, Integer province, Integer status, Page page);
    List<IdNamePid> listIdNameByCondition(Integer monitor, Long formsid, Long type, Integer status);
    List<Indicator> listByCondition(Integer monitor, Long formsid, List<Long> type, Integer status, Page page);
    List<Indicator> listByCondition(Integer monitor, Long formsid, Long type, Integer status, Page page);
    List<Indicator> listByCondition(Integer sex, Long formsid, Integer status);

    List<IdNameCode> listAll();
    
    /**
     * 获取所有的类型(id和名称)
     * 
     * @return
     */
    List<IdNamePid> getAllNames();

    //查找父级的父级的父级的父级(最顶层)的元素
    Indicator findParentIndicator(Indicator indicator);
    
    //获取相同父亲的所有子指标
    List<Indicator> getSameBloodByParent(List<Indicator> result, Indicator indicator);

    List<Long> getIndicatorId(List<Indicator> indicatorList);

    List<Long> getTypeIdsByCondition(Long formsid, List<Long> ids);
    
}
